package com.kkb.shopcenter.controller;


import com.github.pagehelper.PageInfo;
import com.kkb.shopcenter.api.MemberInfoService;
import com.kkb.shopcenter.common.common.HttpResult;
import com.kkb.shopcenter.common.pojo.MemberInfo;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api")
public class MemberController {

    @Reference
    private MemberInfoService memberInfoService;

    @RequestMapping("/getMember")
    public HttpResult getMember(Integer page, Integer size, Integer level, String memberName){
        PageInfo<MemberInfo> memberInfo=memberInfoService.getMemberList(page+1,size,level,memberName);
        return HttpResult.success(memberInfo);
    }

    @PutMapping("/editMemberInfo")
    public HttpResult editMemberInfo(@RequestBody MemberInfo memberInfo){
        //修改会员信息
        int result=memberInfoService.editMember(memberInfo);
        return HttpResult.success(result);
    }

    @DeleteMapping("/deleteMember")
    public HttpResult deleteMember(Long id){
        int result=memberInfoService.deleteMember(id);
        return HttpResult.success(result);
    }
}
